//
//  GHUtils.m
//  GodHorses
//
//  Created by Mac on 2017/11/14.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "TMUtils.h"

@implementation TMUtils
+ (void)netWorkMonitorinCanUseWithHandle:(void (^)())handle{
    
    AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
    [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        if (status == AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi) {
            if (handle) {
                handle();
            }
        }
    }];
    [manager startMonitoring];
}

+ (UINavigationBar *)navigationBar{
    UINavigationController* nav = (id)[UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers.firstObject;
    return nav.navigationBar;
}
+  (UITabBar *)tabbar{
    UITabBarController* tab = (id)[UIApplication sharedApplication].keyWindow.rootViewController;
    return tab.tabBar;
}
+ (CGFloat)navgationBarBootom{
    if (ios11) {
        UIWindow * window = UIApplication.sharedApplication.delegate.window;
        if (window.safeAreaInsets.top) {
            return 88;
        }
    }

    return 64;
}
+ (CGFloat)tabBarTop{
    if (ios11) {
        UIWindow * window = UIApplication.sharedApplication.delegate.window;
        if (window.safeAreaInsets.top) {
            return (UIScreenHeight - 83);
        }
    }
    return (UIScreenHeight - 49);
}


@end
